<?php
/***

Template Name:Reviews

***/
?>
<?php get_header(); ?>        
    

<div class="main_content padd">
    <div id="primary">       

        
       <div class="pro_reviews">
<?php 
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('post_type=reviews&paged='.$paged);
if($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();

// usually needed
global $custom_metabox;

$meta = get_post_meta(get_the_ID(), $custom_metabox->get_the_ID(), TRUE); 

 
?>            
            <div class="single_review">
            <?php if($meta['r_ribbon']!=''){ ?>
                <div class="ribbon">
                    <img src="<?php echo get_template_directory_uri();?>/images/<?php echo $meta['r_ribbon']; ?>.png" alt="recommended" />
                </div><!--end ribbon-->
           <?php } ?>     
                <div class="review_data">
                <div class="preload_image">
                    <a class="single_image" href="<?php $links=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),full); echo $links[0]; ?>"><img src="<?php print_thumbnail_src('280','180') ?>" alt="single_review" /></a>
                </div><!--end preload-->
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <p class="prod_meta">
                <?php echo get_the_term_list( get_the_ID(), 'review-cats', '', ',', '' ) ?> 
                </p>
                <?php echo theme_excerpt('200',''); ?>
                </div><!--end review_data-->
                <div class="review_bottom">
                    <div class="review_rating stars_<?php echo $meta['r_rating']; ?>">
                    <?php echo $meta['r_rating']; ?> stars
                    </div><!--end review_rating-->

                    <div class="link_buttons">
                    <a href="<?php echo $meta['r_aff_link']; ?>" class="visit"  target="_blank"><span>Visit Website</span></a>
                    <a href="<?php the_permalink(); ?>" class="read"><span>Read Review</span></a>
                    </div><!--end link_buttons-->
                </div><!--end review_bottom-->
            </div><!--end single_review-->
<?php if(get_option('pr_banner_img') && get_option('pr_banner_link')){ ?>
<?php $i++; if($i==1){ if(get_option('pr_banner_img')) {?>            
            <div class="reviews_banner">
              <a href="<?php echo get_option('pr_banner_link'); ?>"><img src="<?php echo get_option('pr_banner_img'); ?>" alt="banner2" align="middle" /></a>
            </div>
<?php }}} ?>
<?php endwhile; endif; wp_reset_query(); ?>        
     
            <div class="reviews_pagination">
<?php get_template_part('/includes/navigation'); ?>
            </div><!--end reviews_pagination-->
        </div><!--end pro_reviews-->
        
        
        </div><!--end primary-->
        
<?php get_sidebar(); ?>

        </div><!--end main_content-->
        
<?php get_footer(); ?>